package br.siseventos.model;
// Generated 29/10/2012 23:23:36 by Hibernate Tools 3.2.1.GA

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * TdTipoLocal generated by hbm2java
 */
@Entity
@Table(name = "td_tipo_local", catalog = "SisEventosDB", uniqueConstraints =
@UniqueConstraint(columnNames = "nme_tipo_local"))
public class TdTipoLocal extends BaseModel {

    private Integer idtTipoLocal;
    private String nmeTipoLocal;
    private String dscTipoLocal;
    private Set<TbLocal> tbLocals = new HashSet<TbLocal>(0);

    public TdTipoLocal() {
    }

    public TdTipoLocal(String nmeTipoLocal) {
        this.nmeTipoLocal = nmeTipoLocal;
    }

    public TdTipoLocal(String nmeTipoLocal, String dscTipoLocal, Set<TbLocal> tbLocals) {
        this.nmeTipoLocal = nmeTipoLocal;
        this.dscTipoLocal = dscTipoLocal;
        this.tbLocals = tbLocals;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "idt_tipo_local", unique = true, nullable = false)
    public Integer getIdtTipoLocal() {
        return this.idtTipoLocal;
    }

    public void setIdtTipoLocal(Integer idtTipoLocal) {
        this.idtTipoLocal = idtTipoLocal;
    }

    @Column(name = "nme_tipo_local", unique = true, nullable = false, length = 80)
    public String getNmeTipoLocal() {
        return this.nmeTipoLocal;
    }

    public void setNmeTipoLocal(String nmeTipoLocal) {
        this.nmeTipoLocal = nmeTipoLocal;
    }

    @Column(name = "dsc_tipo_local", length = 200)
    public String getDscTipoLocal() {
        return this.dscTipoLocal;
    }

    public void setDscTipoLocal(String dscTipoLocal) {
        this.dscTipoLocal = dscTipoLocal;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "tdTipoLocal")
    public Set<TbLocal> getTbLocals() {
        return this.tbLocals;
    }

    public void setTbLocals(Set<TbLocal> tbLocals) {
        this.tbLocals = tbLocals;
    }
    // Sobrescrevendo metodos utilitarios importantes   
    @Override
    public String toString() {
        return this.nmeTipoLocal;
    }

    @Override
    public boolean equals(Object outro) {
        return (outro instanceof TdTipoLocal) && (this.idtTipoLocal != null)
                ? idtTipoLocal.equals(((TdTipoLocal) outro).getIdtTipoLocal())
                : (outro == this);
    }

    @Override
    public int hashCode() {
        return (idtTipoLocal != null)
                ? (this.getClass().hashCode() + idtTipoLocal.hashCode())
                : super.hashCode();
    }
}
